$(document).ready(function(){
$("span[id$='-tab']").hover(
function(){
if($(this).attr("class")=="tab-back")
$(this).attr("class","tab-hover");},
function(){
if($(this).attr("class")=="tab-hover")
$(this).attr("class","tab-back");}
);
$("span[id$='-tab']").click(function(){
if($(this).attr("class")!="tab-front")
{
$("span[id$='-tab']").attr("class","tab-back");
$(this).attr("class","tab-front");

var name=$(this).attr("id").replace("-tab","");
$("table[id$='-table']").hide();
$("table[id='" + name + "-table']").show();
}});
});